package com.bsj.power.common.def.entity.path;

import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description PathPoint
 * @time 2024/4/26 15:22
 */
@Data
@TableName(value = "tab_path_point")
@NoArgsConstructor
public class PathPoint {

    /**
     * 位置点id
     */
    @TableId(value = "point_id", type = IdType.AUTO)
    private Integer pointId;

    /**
     * 围栏id
     */
    @TableField("path_id")
    private Integer pathId;

    /**
     * x轴坐标点
     */
    @TableField("x")
    private Double x;

    /**
     * y轴坐标点
     */
    @TableField("y")
    private Double y;

    /**
     * z轴坐标点
     */
    @TableField("z")
    private Double z;

    public PathPoint(Double x, Double y, Double z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public PathPoint(Integer pointId,Double x, Double y, Double z) {
        this.pointId = pointId;
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public String toAddString() {
        double rX = NumberUtil.round(x, 2).doubleValue();
        double rZ = NumberUtil.round(z, 2).doubleValue();
        return rX + "," + rZ;
    }

}
